package com.example.filecabinet.controller;

import com.example.filecabinet.entity.Employee_info;
import com.example.filecabinet.service.Employee_infoService;
import com.thfdcsoft.framework.common.http.dto.BaseHttpRspn;
import com.thfdcsoft.framework.common.json.jackson.JacksonFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping(value = "/employee")
public class EmployeeController {
    @Autowired
    Employee_infoService employee_infoService;

    /**
     * 判断是否员工
     *
     * @return
     */
    @RequestMapping(value = "/checkStaff", method = RequestMethod.POST)
    @ResponseBody
    public String checkStaff(@RequestBody String employeeIdNumber) {
        Employee_info employee_info = employee_infoService.selectByEmployeeIdNumber(employeeIdNumber);
        BaseHttpRspn result = new BaseHttpRspn(false);
        if (employee_info != null) {
            result.setResult(true);
            result.setRespJson(JacksonFactory.writeJson(employee_info));
        }
        return JacksonFactory.writeJson(result);
    }
}
